package ua.kpi_java_training5.alekseenko.src.module2;

import com.sun.org.glassfish.external.statistics.Statistic;

import java.util.ArrayList;

/**
 * Author: Aleksey Alekseenko
 * Date: 04.06.13
 */
public class FishFactory {
    ArrayList<Fish> victims;
    ArrayList<Fish> predators;

    public FishFactory(int length, int height) {
        victims = new ArrayList<Fish>();
        predators = new ArrayList<Fish>();
        for (int index = 0; index < Initialization.numberVictims; index++) {
            victims.add(new Victim());
            victims.get(index).position =
                    new Position((int) (Math.random() * length), (int) (Math.random() * height));
        }
        for (int index = 0; index < victims.size(); index++) {
            victims.get(index).fishFactory = FishFactory.this;
        }
        for (int index = 0; index < Initialization.numberPredators; index++) {
            predators.add(new Predator());
            predators.get(index).position =
                    new Position((int) (Math.random() * length), (int) (Math.random() * height));
        }

        for (int index = 0; index < predators.size(); index++) {
            predators.get(index).fishFactory = FishFactory.this;
        }
    }
}
